package bancosys.tec.datadigester.fileregistry.persister.listener;

import jmine.tec.annotations.Unmodifiable;
import bancosys.tec.datadigester.DataDigesterController;
import bancosys.tec.datadigester.fileregistry.domain.FileRegistry;
import bancosys.tec.persist.persister.listener.AbstractPersisterListener;

/**
 * Persister listener de file registry que garante que quando um novo registro for savo, o cache do controller seja limpo.
 * 
 * @author piercio
 */
@Unmodifiable
public class FileRegistryPersisterListener extends AbstractPersisterListener<FileRegistry> {

    private DataDigesterController controller;

    /**
     * {@inheritDoc}
     */
    @Override
    protected void afterInsert(FileRegistry bean) {
        this.controller.clearDriverRegistry();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void afterUpdate(FileRegistry bean) {
        this.controller.clearDriverRegistry();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void afterRemove(FileRegistry bean) {
        this.controller.clearDriverRegistry();
    }

    /**
     * @param controller o valor para o campo controller.
     */
    public void setController(DataDigesterController controller) {
        this.controller = controller;
    }

}
